var Print = new Vue({

    el : '#Printlist',
    data:{
        xiangmuId : $("#xiangmuId").val(),
        xiangmuleixing : $("#xiangmuLeixing").val(),
        xiangmu : {},

        printlist : [],

        show : false,					// 显示列表是否有数据

    },
    created : function() {

        var _this = this;
        _this.bindXiangmu();

        _this.bindPrintlist();


    },
    methods : {
        tobohui:function (ppid){
            var _this = this;

            layer.confirm("确定驳回该委员的提交吗？",{
                btn : ['是','否']
            },function(){
                layer.open({type:3});

                $.post("/TyController/bohui", {
                    id:ppid,
                    random : Math.random()
                }, function(ppData) {
                    if (ppData != null) {
                        layer.closeAll("loading");

                        if(ppData.result != "1"){
                            layer.alert(ppData.message);
                        }else{
                            layer.open({
                                time:1000,
                                btn:[],
                                content:"驳回成功!",
                            });

                            _this.bindPrintlist();
                        }
                    }
                },"json");
            })
        },
        toback:function (){

            window.history.go(-1);
        },
        bindXiangmu:function (){
            var _this = this;
            layer.open({type:3});
            $.post('/xiangmu/find_one', {
                xianmguid : _this.xiangmuId,
                rdm : Math.random()
            },function(ppData) {
                layer.closeAll("loading");
                if(ppData != null){
                    if(ppData.result == "1"){
                        var data = ppData.resultContent;
                        _this.xiangmu = data;
                    }else{
                        layer.alert(ppData.message);
                    }
                }
            },"json");
        },
        HuizongbiaoView:function(){
            location.href="/TyController/HuizongbiaoView?xiangmuid="+this.xiangmuId+"&xiangmuleixing="+this.xiangmuleixing;
        },
        shengchengjieguo:function(){
            var _this = this;
            layer.open({type:3});

            $.post('/shengchanqiyezhongjianjieguo/getZhongjianjieguo', {
                xiangmuid : _this.xiangmuId,
                rdm : Math.random()
            },function(ppData) {
                layer.closeAll("loading");
                if(ppData != null){
                    if(ppData.result == "1"){
                        layer.alert("生成成功");
                    }else{
                        layer.alert(ppData.message);
                    }
                }
            },"json");
        },

        checknextlunci:function(){
            var _this = this;
            layer.open({type:3});

            $.post('/shengchanqiyezhongjianjieguo/checknextlunci', {
                xiangmuid : _this.xiangmuId,
                rdm : Math.random()
            },function(ppData) {
                layer.closeAll("loading");
                if(ppData != null){
                    if(ppData.result == "1"){
                        layer.alert(ppData.resultContent);
                    }else{
                        layer.alert(ppData.message);
                    }
                }
            },"json");
        },

        bindPrintlist:function (){

            var _this = this;
            layer.open({type:3});

            $.post('/renyuanfenpei/findRenyuanFenpeiByXiangmuId', {
                xiangmuid : _this.xiangmuId,
                rdm : Math.random()
            },function(ppData) {
                layer.closeAll("loading");
                if(ppData != null){
                    if(ppData.result == "1"){
                        var data = ppData.resultContent;
                        _this.printlist = data;
                        _this.show=true;
                    }else{
                        layer.alert(ppData.message);
                        _this.show=false;
                    }
                }
            },"json");
        },

        toShowhuizongbiaoList  : function(){

            /*location.href="huizongbiao";*/

        },
    }

})

